<template>
  <ul class="list">
    <li class="list-item" v-for="(item, index) in upList" :key="index">
      {{ item }}</li>
  </ul>
</template>

<script setup>
import {inject} from 'vue'

const upList=inject('list')   //子组件inject注入 ，只能从上往下
</script>

<style scoped>
ul {
  margin: 0;
  padding: 0;
  margin-top: 10px;
}

li {
  list-style: none;
  height: 30px;
  width: 204px;
  padding: 4px 10px;
  box-sizing: border-box;
  border: 1px solid #999;
  border-radius: 2px;
}
</style>